package com.cdc.youthbanner.ui;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.cdc.youthbanner.R;
import com.cdc.youthbanner.adapter.MyRecyclerViewAdapter;
import com.cdc.youthbanner.databinding.ActivityRecyclerviewBannerBinding;
import com.cdc.youthbanner.util.ParentRecyclerView;

public class BannerListFragment extends Fragment {
    private ActivityRecyclerviewBannerBinding mBinding;
    private static int index;


    public static Fragment newInstance(int i) {
        index = i;
        return new BannerListFragment();
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mBinding=ActivityRecyclerviewBannerBinding.inflate(inflater,container,false);
        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mBinding.text.setText("当前页:"+index);
        mBinding.netRv.setLayoutManager(new LinearLayoutManager(getActivity()));
        mBinding.netRv.setAdapter(new MyRecyclerViewAdapter(getActivity()));
    }

}
